# Contributor: Steven Guikal <void@fluix.one>
# Maintainer: Steven Guikal <void@fluix.one>
pkgname=py3-fastapi
pkgver=0.108.0
pkgrel=0
pkgdesc="Modern, high-performance, web framework for building APIs based on standard Python type hints"
url="https://github.com/tiangolo/fastapi"
arch="noarch !armhf !ppc64le" # limited by py3-starlette
license="MIT"
depends="
	py3-pydantic
	py3-starlette
	"
makedepends="
	py3-gpep517
	py3-hatchling
	py3-installer
	"
checkdepends="
	py3-dirty-equals
	py3-email-validator
	py3-flask
	py3-httpx
	py3-orjson
	py3-passlib
	py3-peewee
	py3-pytest
	py3-pytest-xdist
	py3-python-jose
	py3-python-multipart
	py3-sqlalchemy
	py3-trio
	py3-ujson
	py3-yaml
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tiangolo/fastapi/archive/refs/tags/$pkgver.tar.gz
	pytest-markers.patch
	"
builddir="$srcdir/fastapi-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# Depends on older SQLAlchemy and slated for removal:
	# https://github.com/tiangolo/fastapi/blob/dd4e78ca7b09abdf0d4646fe4697316c021a8b2e/requirements-tests.txt#L9
	.testenv/bin/python3 -m pytest -p no:warnings \
		--ignore-glob "tests/test_tutorial/*sql_databases" \
		--ignore tests/test_dependency_normal_exceptions.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
c7f1b265c680e75e2654623e14c94d06fa880e219346d577c70bb070dbf15f424ebd4fa4450ce0e364dc4d794ba496dee8e24f20ff292ef6ee7f0eed2aee05a4  py3-fastapi-0.108.0.tar.gz
854946e3e52460edfd84cd44e254659354171e88245f4134c7f943a07bf3b08455ad81c54f4c58c50f639aa7288e25d81711f3d7867bbe2d6c83844e2fdd9921  pytest-markers.patch
"
